﻿using BPMN.Application.IService;
using BPMN.Domain.ProcessModel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BPMN.WebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ProcEsController : ControllerBase
    {
        private readonly IProcesService proces;

        public ProcEsController(IProcesService proces)
        {
            this.proces = proces;
        }

        /// <summary>
        /// 工序单表显示数据
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetResultShows()
        {
            return Ok(await proces.GetResultShows());
        }
        /// <summary>
        /// 报工权限
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetResult")]
        public async Task<IActionResult> GetResult()
        {
            return Ok(await proces.GetResult());
        }

        /// <summary>
        /// 不良品相显示数据
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpGet("GetDefective")]
        public async Task<IActionResult> GetDefective()
        {
            return Ok(await proces.GetDefective());
        }



        /// <summary>
        /// 添加
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPost("ResultAdd")]
        public async Task<IActionResult> ResultAdd(ProcessShows process)
        {

            return Ok(await proces.ResultAdd(process));
        }
        /// <summary>
        /// 工序显示数据
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpGet("ProCcessShow")]
        public async Task<IActionResult> ProCcessShow(string Process_BianHao, string Process_Name, int Reporting_Id, int Defective_Id, decimal PeiBiMin, decimal PeibiMax, string dateMax, string dateMin)
        {
            return Ok(await proces.ProCcessShow(Process_BianHao, Process_Name, Reporting_Id, Defective_Id, PeiBiMin, PeibiMax, dateMax, dateMin));

        }
    }
}
